<?php
   /*************************************************************************
    * File    : initmpay24_a.php
    * Version : $Id: initmpay24_a.php,v 1.8 2009/04/02 05:42:40 thomas Exp $
    * Author  : wolfgang.schaefer@mPAY24.com
    *************************************************************************/

   include_once("./AcceptPayment.php");

   $etp_url = "https://www.mPAY24.com/app/bin/etpv5";
   #$etp_url = "https://test.mPAY24.com/app/bin/etpv5";

   $request = new AcceptPayment(($_POST['P_TYPE']), $etp_url);
   $request->setMerchantId("70015");
   #$request->setMerchantId("90015");
   $request->setPrice($_POST['PRICE']);
   $request->setCurrency($_POST['CURRENCY']);
   $request->setTid("0a1b2c3d4e");
   switch($_POST['P_TYPE']) {
      case 'CC':
         $request->setBrand($_POST['BRAND']);
         $request->setIdentifier($_POST['IDENTIFIER']);
         $request->setExpiry($_POST['EXPIRY']);
         $request->setCvc($_POST['CVC']);
         if ($_POST['AUTH_3DS']=='Y')
	    $request->setThreeDs(true);
         break;
      case 'ELV':
         $request->setIdentifier($_POST['IDENTIFIER']);
         $request->setSortCode($_POST['SORT_CODE']);
         break;
      case 'EPS':
         $request->setBrand($_POST['BRAND']);
         break;
      case 'MAESTRO':
         $request->setIdentifier($_POST['IDENTIFIER']);
         $request->setExpiry($_POST['EXPIRY']);
         break;
      case 'MIA':
         $request->setIdentifier($_POST['IDENTIFIER']);
         break;
      case 'PB':
         $request->setIdentifier($_POST['IDENTIFIER']);
         break;
      case 'GIROPAY':
         $request->setSortCode($_POST['SORT_CODE']);
         break;
      case 'PSC':
         $request->setBrand($_POST['BRAND']);
         break;
   }
   $request->setLanguage("DE");
   $request->setOrderDesc("orderdescription");
   $request->setCustomer("test");
   
   // set Urls
   $request->setSuccessUrl($_REQUEST['SERVER'] . "/success.html");
   $request->setErrorUrl($_REQUEST['SERVER'] . "/mpay24_templates/err.php");
   $request->setConfirmUrl($_REQUEST['SERVER'] . "mpay24_templates/confirmed_mpay24.php?OP=C0+1");
   
   $request->send();
 
   $request->parseResponse();
   $request->getResponse();
?>

